EMT Practice Test

1. Question Content...


Question List

Question1: (Full question statement)
A developer must create a CreditCardPayment class that provides an implementation of an existing Payment class.
public virtual class Payment {
public virtual void makePayment(Decimal amount) {
// implementation
}
}
Which is the correct implementation?

Question2: Universal Containers (UC) wants to lower its shipping cost while making the shipping process more efficient.
The Distribution Officer advises UC to implement global addresses to allow multiple Accounts to share a default pickup address. The developer is tasked to create the supporting object and relationship for this business requirement and uses the Setup Menu to create a custom object called "Global Address".
Which field should the developer add to create the most efficient model that supports the business need?

Question3: A developer creates a new Apex trigger with a helper class, and writes a test class that only exercises 95% coverage of the new Apex helper class.
Change Set deployment to production fails with the test coverage warning:
"Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required." What should the developer do to successfully deploy the new Apex trigger and helper class?

Question4: A custom Visualforce controller calls the ApexPages.addMessage() method, but no messages are rendering on the page.
Which component should be added to the Visualforce page to display the message?

Question5: A developer completed modifications feature that is comprised of two elements:
* Apex trigger
* Trigger handler Apex class
What are two factors that the developer must take into account to properly deploy them to the production environment?
Choose 2 answers

Question6: A developer must perform a complex SOQL query that joins two objects in a Lightning component.
How can the Lightning component execute the query?

Question7: Since Aura application events follow the traditional publish-subscribe model, which method is used to fire an event?

Question8: A developer creates a Lightning web component that imports a method within an Apex class. When a Validate button is pressed, the method runs to execute complex validations.
In this implementation scenario, which two options are.. of the Controller according to the MVC architecture?
Choose 2 answers

Question9: Which exception type cannot be caught?

Question10: Universal Containers wants to ensure that all new leads created in the system have a valid email address. They have already created a validation rule to enforce this requirement, but want to add an additional layer of validation using automation.
What would be the best solution for this requirement?

Question11: A Developer Edition org has five existing accounts. A developer wants to add 10 more accounts for testing purposes.
The following code is executed in the Developer Console using the Execute Anonymous window:

How many total accounts will be in the org after this code is executed?

Question12: A developer created a trigger on the Account object and wants to test if the trigger is properly bulkified. The developer team decided that the trigger should be tested with 200 account records with unique names.
What two things should be done to create the test data within the unit test with the least amount of code?
Choose 2 answers

Question13: Where are two locations a developer can look to find information about the status of batch or future methods?
Choose 2 answers

Question14: What are two considerations for deploying from a sandbox to production?
Choose 2 answers

Question15: As part of new feature development, a developer is asked to build a responsive application capable of responding to touch events, that will be executed on stateful clients.
Which two technologies are built on a framework that fully supports the business requirement? Choose 2 answers

Question16: What should a developer use to obtain the Id and Name of all the Leads, Accounts, and Contacts that have the company name "Universal Containers?

Question17: A developer has an integer variable called maxAttempts. The developer needs to ensure that once maxAttempts is initialized, it preserves its value for the length of the Apex transaction; while being able to share the variable's state between trigger executions.
How should the developer declare maxAttempts to meet these requirements?

Question18: What is the value of the Trigger.old context variable in a before insert trigger?

Question19: For which three items can a trace flag be configured?
Choose 3 answers

Question20: Which three code lines are required to create a Lightning component on a Visualforce page?
Choose 3 answers.

Question21: What is the result of the following code?

Question22: Refer to the following Apex code:
apex
Copy
Integer x = 0;
do {
x++;
} while (x < 1);
System.debug(x);
What is the value of x when it is written to the debug log?

Question23: A developer wants to import 500 Opportunity records into a sandbox.
Why should the developer choose to use Data Loader instead of Data Import Wizard?

Question24: Which Apex class contains methods to return the amount of resources that have been used for a particular governor, such as the number of DML statements?

Question25: A company has a custom object, order __c, that has a required, unique external ID field called order Number__c.
Which statement should be used to perform the DML necessary to insert new records and update existing records in a list of Order __c records using the external ID field?

Question26: Which two characteristics are true for Lightning Web Component custom events?
Choose 2 answers

Question27: What are two ways a developer can get the status of an enqueued job for a class that implements the queueable interface?
Choose 2 answers

Question28: What are three considerations when using the @lnvocableMethod annotation in Apex?
Choose 3 answers

Question29: A developer has the following requirements:
* Calculate the total amount on an Order.
* Calculate the line amount for each Line Item based on quantity selected and price.
* Move Line Items to a different Order if a Line Item is not in stock.
Which relationship implementation supports these requirements on its own?

Question30: Provide question feedback here (optional):

Based on this code, what is the value of x?

Question31: Universal Containers hires a developer to build a custom search page to help users find the Accounts they want. Users will be able to search on Name, Description, and a custom comments field.
Which consideration should the developer be aware of when deciding between SOQL and SOSL?
Choose 2 answers

Question32: A developer creates a batch Apex job to update a large number of records, and receives reports of the job timing out and not completing.
What is the first step towards troubleshooting the issue?

Question33: How can a developer check the test coverage of autolaunched Flows before deploying them in a change set?

Question34: A developer wants to mark each Account in a List<Account> as either Active or Inactive, based on the value in the LastModified each Account being greater than 90 days in the past.
Which Apex technique should the developer use?

Question35: Where are two locations a developer can look to find information about the status of batch or future methods?
Choose 2 answers

Question36: A developer creates a custom exception as shown below:
public class ParityException extends Exception { }
What are two ways the developer can fire the exception in Apex?

Question37: Universal Containers wants to assess the advantages of declarative development versus programmatic customization for specific use cases in its Salesforce implementation.
What are two characteristics of declarative development over programmatic customization?
Choose 2 answers

Question38: Universal Containers has a large number of custom applications that were built using a third-party JavaScript framework and exposed using Visualforce pages. The company wants to update these applications to apply styling that resembles the look and feel of Lightning Experience.
What should the developer do to fulfill the business request in the quickest and most effective manner?

Question39: Which two statements are true about using the @testSetup annotation in an Apex test class?
Choose 2 answers

Question40: A developer is integrating with a legacy on-premise SQL database.
What should the developer use to ensure the data being integrated is matched to the right records in Salesforce?

Question41: Which statement describes the execution order when triggers are associated to the same object and event?

Question42: A developer has a single custom controller class that works with a Visualforce Wizard to support creating and editing multiple sObjects. The wizard accepts data from user inputs across multiple Visualforce pages and from a parameter on the initial URL.
Which three statements are useful inside the unit test to effectively test the custom controller?
Choose 3 answers

Question43: Which three steps allow a custom Scalable Vector Graphic (SVG) to be included in a Lightning web component?
Choose 3 answers

Question44: While writing an Apex class, a developer wants to make sure that all functionality being developed is handled as specified by the requirements.
Which approach should the developer use to be sure that the Apex class is working according to specifications?

Question45: What should a developer use to fix a Lightning web component bug in a sandbox?

Question46: Consider the following code snippet:
apex
CopyEdit
public class with sharing AccountsController {
@AuraEnabled
public List<Account> getAllAccounts(){
return [SELECT Id, Name, Industry FROM Account];
}
}
Apex Test Class Snippet:
apex
CopyEdit
@isTest
private class with sharing AccountsController_Test {
@testSetup
private static void makeData(){
User user1 = [SELECT Id FROM User WHERE Profile.Name = 'System Administrator' AND isActive = true LIMIT 1]; User user2 = [SELECT Id FROM User WHERE Profile.Name = 'Standard User' AND UserName = 'test@test.
com' AND isActive = true LIMIT 1];
TestUtils.insertAccounts(10, user1.Id);
TestUtils.insertAccounts(20, user2.Id);
}
@isTest
private static void getAllAccounts_StandardUser_Test(){
List<Account> result = AccountsController.getAllAccounts();
System.assertEquals(20, result.size());
}
}
When the test class runs, the assertion fails.
Which change should the developer implement in the Apex test method to ensure the test method executes successfully?

Question47: A developer writes a trigger on the Account object on the before update event that increments a count field. A record triggered flow also increments the count field every time that an Account is created or updated.
What is the value of the count field if an Account is inserted with an initial value of zero, assuming no other automation logic is implemented on the Account?

Question48: What can be used to override the Account's standard Edit button for Lightning Experience?

Question49: When using Salesforce DX, what does a developer need to enable to create and manage scratch orgs?

Question50: Universal Containers has a support process that allows users to request support from its engineering team using a custom object, Engineering Support c.
Users should be able to associate multiple Engineering Support __c records to a single Opportunity record.
Additionally, aggregate information
about the Engineering Support _c records should be shown on the Opportunity record.
Which relationship field should be implemented to support these requirements?

Question51: A developer is tasked to perform a security review of the ContactSearch Apex class that exists in the system.
Within the class, the developer identifies the following method as a security threat:
ist<Contact> performSearch (String lastName} [
return Database.query('SELECT Id, FirstName, LastName FROM Contact WHERE LastName Like s'+lastName+'s'")?; What are two ways the developer can update the method to prevent a SOQL injection attack?
Choose 2 answers

Question52: Universal Containers (UC) processes orders in Salesforce in a custom object, Order__c. They also allow sales reps to upload CSV files with thousands of orders at a time.
A developer is tasked with integrating orders placed in Salesforce with UC's enterprise resource planning (ERP) system.
After the status for an Order__c is first set to 'Placed', the order information must be sent to a REST endpoint in the ERP system that can process one order at a time.
What should the developer implement to accomplish this?

Question53: A software company uses the following objects and relationships:
* Case: to handle customer support issues
* Defect__c: a custom object to represent known issues with the company's software
* Case Defect__c a junction object between Case and Defect __c to represent that a defect is a cause of a customer issue Case and Defect__c have Private organization-wide defaults.
What should be done to share a specific Case_Defect__c record with a user?

Question54: A developer is asked to write helper methods that create test data for unit tests.

What should be changed in the TestUtils class so that its methods are only usable by unit test methods?

Question55: What is an example of a polymorphic lookup field in Salesforce?

Question56: Which two events need to happen when deploying to a production org?
Choose 2 answers

Question57: Universal Containers implemented a private sharing model for the Account object. A custom Account search tool was developed with Apex to help sales representatives find accounts that match multiple criteria they specify. Since its release, users of the tool report they can see Accounts they do not own.
What should the developer use to enforce sharing permissions for the currently logged in user while using the custom search tool?

Question58: Refer to the component code requirements below:
<lightning:layout multipleRows="true">
<lightning:layoutItem size="12">{!v.account.Name}</lightning:layoutItem>
<lightning:layoutItem size="12">{!v.account.AccountNumber}</lightning:layoutItem>
<lightning:layoutItem size="12">{!v.account.Industry}</lightning:layoutItem>
</lightning:layout>
Requirements:
* For mobile devices, the information should display in three rows.
* For desktops and tablets, the information should display in a single row.
Requirement 2 is not displaying as desired.
Which option has the correct component code to meet the requirements for desktops and tablets?

Question59: Universal Containers needs to create a custom user interface component that allows users to enter information about their accounts.
The component should be able to validate the user input before saving the information to the database.
What is the best technology to create this component?

Question60: Universal Containers wants to automatically assign new cases to the appropriate support representative based on the case origin. They have created a custom field on the Case object to store the support representative name.
What is the best solution to assign the case to the appropriate support representative?

Question61: An Apex method, getAccounts, that returns a List of Accounts given a searchTerm, is available for Lightning Web Components to use.
What is the correct definition of a Lightning Web Component property that uses the getAccounts method?

Question62: A developer needs to make a custom Lightning Web Component available in the Salesforce Classic user interface Which approach can be used to accomplish this?

Question63: Universal Containers decides to use purely declarative development to build out a new Salesforce application.
Which two options can be used to build out the business logic layer for this application?
Choose 2 answers

Question64: Given the following Apex statement:
Account myAccount = [SELECT Id, Name FROM Account);
What occurs when more than one Account is returned by the SOQL query?

Question65: A developer at AW Computing is tasked to create the supporting test class for a programmatic customization that leverages records stored within the custom object, Pricing Structure c. AW Computing has a complex pricing structure for each item on the store, spanning more than 500 records.
Which two approaches can the developer use to ensure Pricing _Structure__c records are available when the test class is executed?
Choose 2 answers

Question66: A lead developer creates a virtual class called "OrderRequest". Consider the following code snippet:
apex
Copy
public class CustomerOrder {
// code implementation
}
How can a developer use the OrderRequest class within the CustomerOrder class?

Question67: What is the result of the following code snippet?
public word doWork(Account acct) {
for (Integer i = 0; i <= 2007 i++) {
insert acct;
}

Question68: The following Apex method is part of the ContactService class that is called from a trigger:

How should the developer modify the code to ensure best practices are met?
A)

B)

C)

D)

Question69: A credit card company needs to implement the functionality for a service agent to process damaged or stolen credit cards. When the customers call in, the service agent must gather many pieces of information. A developer is tasked to implement this functionality.
What should the developer use to satisfy this requirement in the most efficient manner?

Question70: Universal Containers wants to back up all of the data and attachments in its Salesforce org once a month.
Which approach should a developer use to meet this requirement?

Question71: Which action causes a before trigger to fire by default for Accounts?

Question72: When importing and exporting data into Salesforce, which two statements are true?
Choose 2 answers

Question73:
When the code executes, a DML exception is thrown.
How should a developer modify the code to ensure exceptions are handled gracefully?

Question74: A developer is working on a project to import data from an external system into Salesforce. The data contains sensitive information that should not be visible to all users in Salesforce.
What should the developer do to ensure that the data is secure?

Question75: Consider the following code snippet:
public static List<Lead> obtainAllFields(Set<Id> leadIds) {
List<Lead> result = new List<Lead>();
for (Id leadId : leadIds) {
result.add([SELECT FIELDS(ALL) FROM Lead WHERE Id = :leadId]);
}
return result;
}
Given the multi-tenant architecture of the Salesforce platform, what is a best practice a developer should implement to ensure successful execution of the method?

Question76: A developer needs to create a baseline set of data (Accounts, Contacts, Products, Assets) for an entire suite of Apex tests allowing them to test isolated requirements for various types of Salesforce cases.
Which approach can efficiently generate the required data for each unit test?

Question77: Which two are phases in the Aura application event propagation framework?
Choose 2 answers

Question78: When a user edits the Postal Code on an Account, a custom Account text field named "Timezone" must be updated based on the values in a PostalCodeToTimezone__c custom object.
Which two automation tools can be used to implement this feature? Choose 2 answers

Question79: The Account object in an organization has a master-detail relationship to a child object called Branch. The following automations exist:
* Roll-up summary fields
* Custom validation rules
* Duplicate rules
developer created a trigger on the Account object.
Which two things should the developer consider while testing the trigger code?
Choose 2 answers

Question80: What is a benefit of developing applications

Question81: A developer is designing a new application on the Salesforce platform and wants to ensure it can support multiple tenants effectively.
Which design framework should the developer consider to ensure scalability and maintainability?

Question82: A team of developers is working on a source-driven project that allows them to work independently, with many different org configurations.
Which type of Salesforce orgs should they use for their development?

Question83: (Full question statement)
Universal Containers recently transitioned fromClassic to Lightning Experience. One of its business processes requirescertain values from the Opportunity objectto be sent via anHTTP REST calloutto itsexternal order management systemwhen the user presses a custom button on the Opportunity detail page.
Example fields:
Name
Amount
Account
Which two methods should the developer implement to fulfill the business requirement?
Choose 2 answers.

Question84: How should a developer write unit tests for a private method in an Apex class?

Question85: A custom picklist field, Pool Preference , exists on a custom object. The picklist contains the following options: 'Vegan', 'Kosher', 'No Preference'. The developer must ensure a value is populated every time a record is created or updated.
What is the optimal way to ensure a value is selected every time a record is saved?

Question86: A developer created these three Rollup Summary fields in the custom object, Project__c:
The developer is asked to create a new field that shows the ratio between rejected and approved timesheets for a given project.
Which should the developer use to implement the business requirement in order to minimize maintenance overhead?

Question87: How is a controller and extension specified for a custom object named "Notice" on a Visualforce page?

Question88: Developers at Universal Containers (UC) use version control to share their code changes, but they notice that when they deploy their code to different environments they often have failures. They decide to set up Continuous Integration (CI).
What should the UC development team use to automatically run tests as part of their CI process?

Question89: Cloud Kicks has a multi-screen flow that its call center agents use when handling inbound service desk calls.
At one of the steps in the flow, the agents should be presented with a list of order numbers and dates that are retrieved from an external order management system in real time and displayed on the screen.
What should a developer use to satisfy this requirement?

Question90: A developer is creating a page that allows users to create multiple Opportunities. The developer is asked to verify the current user's default Opportunity record type, and set certain default values based on the record type before inserting the record.
How can the developer find the current user's default record type?

Question91: Universal Containers (UC) uses a custom object called Vendor. The Vendor custom object has a master-detail relationship with the standard Account object.
Based on some internal discussions, the UC administrator tried to change the master-detail relationship to a lookup relationship, but was not able to do so.
What is a possible reason that this change was not permitted?

Question92: A developer must provide custom user interfaces when users edit a Contact in either Salesforce Classic or Lightning Experience.
What should the developer use to override the Contact's Edit button and provide this functionality?

Question93: A developer must implement a CheckPaymentProcessor class that provides check processing payment capabilities that adhere to what is defined for payments in the PaymentProcessor interface.
apex
Copy
public interface PaymentProcessor {
void pay(Decimal amount);
}
Which is the correct implementation to use the PaymentProcessor interface class?